﻿using System;
using System.Collections.Generic;
using System.Text;
using @(Model.ContractNamespace);
using @Model.DtoNamespace;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using QingShan.Data;

namespace @(Model.Namespace)
{
    /// <summary>
	/// @Model.Remark
    /// </summary>
	[ApiController]
    [Route("[controller]/[action]")]
    public class @(Model.Name)Controller
	{

        private readonly I@(Model.Name)Contract _i@(Model.Name)Contract;

        public @(Model.Name)Controller(I@(Model.Name)Contract i@(Model.Name)Contract)
        {
            _i@(Model.Name)Contract = i@(Model.Name)Contract;
        }

        /// <summary>
        /// 获取数据
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<PageOutputDto<@(Model.Name)OutputDto>> PageAsync(Page@(Model.Name)InputDto dto)
            => await _i@(Model.Name)Contract.PageAsync(dto);

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]public async Task<StatusResult> AddAsync(@(Model.Name)InputDto input)
            => await _i@(Model.Name)Contract.AddAsync(input);

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]public async Task<StatusResult> UpdateAsync(@(Model.Name)InputDto input)
            => await _i@(Model.Name)Contract.UpdateAsync(input);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost]public async Task<StatusResult> DeleteAsync(string id)
            => await _i@(Model.Name)Contract.DeleteAsync(id);
	}
}
